<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>

<h:body>

	<ui:include src="WelcomePage.xhtml" />

	<h:form id="formVehicle">
		<p:growl showDetail="true" />
		<p:panel header="Cadastro de Veículo">
			<p:messages id="globalMessages"></p:messages>
			<h:panelGrid columns="3">
				<h:outputLabel id="labelId" value="ID:" for="textBoxId"></h:outputLabel>
				<p:inputText id="textBoxId" value="#{vehicleBean.vehicle.id}"
					readonly="true" size="5" disabled="true"></p:inputText>
				<br />

				<h:outputLabel id="labelPlaque" value="Placa:" for="textBoxPlaque"></h:outputLabel>
				<p:inputText id="textBoxPlaque"
					value="#{vehicleBean.vehicle.plaque}" size="10" required="true"
					requiredMessage="O placa do veículo é obrigatório" maxlength="8"></p:inputText>
				<p:message for="textBoxPlaque" id="errorMessagePlaque"></p:message>

				<h:outputLabel id="labelChassis" value="Chassis:"
					for="textBoxChassis"></h:outputLabel>
				<p:inputText id="textBoxChassis"
					value="#{vehicleBean.vehicle.chassis}" size="32" required="true"
					requiredMessage="O chassis do veículo é obrigatório" maxlength="30"></p:inputText>
				<p:message for="textBoxChassis" id="errorMessageChassis"></p:message>

				<h:outputLabel id="labelAcquisitionDate" value="Data Aquisição:"
					for="calendarAcquisitionDate"></h:outputLabel>
				<p:calendar pattern="dd/MM/yyyy" id="calendarAcquisitionDate"
					value="#{vehicleBean.vehicle.acquisitionDate}" size="10" />
				<br />

				<h:outputLabel id="labelTest" value="Grupo:"
					for="selelectOneMenuVehicleGroup"></h:outputLabel>
				<p:selectOneMenu id="selelectOneMenuVehicleGroup"
					value="#{vehicleGroupBean.groups}" var="group">
					<f:selectItem itemLabel="Selecione..." itemValue="" />
					<f:selectItem itemLabel="#{group.groupName}"
						itemValue="#{group.id}" />
					<!-- <f:selectItem itemLabel="Utilitários" itemValue="2" /> -->
					<f:selectItems itemLabel="#{group.groupName}"
						itemValue="#{group.id}" />

				</p:selectOneMenu>
				<br />

				<h:outputLabel id="labelModel" value="Modelo:" for="textBoxModel"></h:outputLabel>
				<p:inputText id="textBoxModel" value="#{vehicleBean.vehicle.model}"
					size="32" maxlength="30"></p:inputText>
				<br />



				<h:outputLabel id="labelAccessory" value="Acessórios:"
					for="textBoxAccessory"></h:outputLabel>
				<p:inputText id="textBoxAccessory"
					value="#{vehicleBean.vehicle.accessory}" size="32" maxlength="30"></p:inputText>
				<br />

				<h:outputLabel id="labelRateKmTraveled" value="Tarifa Km Rodado:"
					for="textBoxRateKmTraveled"></h:outputLabel>
				<p:inputText id="textBoxRateKmTraveled"
					value="#{vehicleBean.vehicle.rateKmTraveled}" size="10"
					maxlength="10"></p:inputText>
				<br />

				<h:outputLabel id="labelRateKmFree" value="Tarifa Km Livre:"
					for="textBoxRateKmFree"></h:outputLabel>
				<p:inputText id="textBoxRateKmFree"
					value="#{vehicleBean.vehicle.rateKmFree}" size="10" maxlength="10"></p:inputText>
				<br />

				<h:outputLabel id="labelIsRentedVehicle" value="Veículo Alugado?"
					for="selectOneRadioIsRentedVehicle"></h:outputLabel>
				<p:selectOneRadio id="selectOneRadioIsRentedVehicle"
					value="#{vehicleBean.vehicle.rentedVehicle}">
					<f:selectItem itemLabel="Sim" itemValue="1" />
					<f:selectItem itemLabel="Não" itemValue="0" />
				</p:selectOneRadio>

				<br />
			</h:panelGrid>
			<p:commandButton id="buttonSave" value="Salvar" update="@form"
				action="#{vehicleBean.saveVehicle}"></p:commandButton>
		</p:panel>
	</h:form>
</h:body>
</html>